%percentage of converged experiments as a function of time
function plottime1(dir,m,n)
prefs=strvcat('pref1','pref2');
files=strvcat('2-28','30-38','40-48','50-58','60-64','66-70','72-76','78-82','84-86','88','90','92','94','96','98','100');
tstdata=load(strcat(dir,'\m',int2str(m),'_n',int2str(n),'_d',files(1,:),'_',prefs(1,:),'.all.results'));
numfiles = length(files(:,1));
numprefs = length(prefs(:,1));
num=length(tstdata);
numblocks=tstdata(num,2)+1;
domaincol=3;
resultcol=16;
domain=0;
result=0;
stddev=0;
for k=1:numprefs
  count = 0;
  for i=1:numfiles
    %load a file
    alldata=load(strcat(dir,'\m',int2str(m),'_n',int2str(n),'_d',files(i,:),'_',prefs(k,:),'.all.results'));
    totexp=length(alldata)/numblocks;
    for j=1:totexp;
        count=count+1;
        domain(k,count)=alldata(j*numblocks,domaincol);
        average(k,count)= alldata(j*numblocks,resultcol)/1000;
        stddev(k,count)= alldata(j*numblocks,resultcol+1)/1000;
    end;
  end;
end;


%a1 = x0:(x1-x0)/10:x1;


%for a1=.4
%g=1.5
lw=2;
fs=24;
clf;
set(gca,'FontSize',fs);
%set(gca,'XTick',[1000,2000,3000,4000,5000]);
%set(gca,'XTickLabel',{'1k','2k','3k','4k','5k'});
colors='mcrgby';
%plot(domain,average,'LineWidth',lw);
for i=1:numprefs
    errorbar(domain(i,:),average(i,:),stddev(i,:),'LineWidth',lw,'Color',colors(i));
    hold on;
end;
legend(prefs,'Location','NorthWest');
%ylim([0 200]);
xlim([0 100]);
xlabel('number of bid levels', 'FontSize', fs);
ylabel('time to converge (s)', 'FontSize', fs);
%title('Percentage of all runs that converge to a given error');
hold off;


%name = strcat('./conv6_m',int2str(m),'_',prefs);
%print('-depsc',strcat(name, '.eps'));
%print('-dpdf',strcat(name, '.pdf'));
end

